UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZqpBsUNSzBpXgmX2MQtMMASBm87RsXPctNyWqzrw6Dw='
WHERE
key_id = '16be1cd352eaf91ca11a12e44b36e7a5d15a1f6b3f8b933fca71e2e52e1af3f6'
AND (
token = 'ZqpBsUNSzBpXgmX2MQtMMASBm87RsXPctNyWqzrw6Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)