UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BXbWHi7ayUgFxHSERaaVGmhTUulho0H9ETQYT4Pk8qk='
WHERE
key_id = '3c6debdea2e52971b1ad1fc2f3a9991cd10c61ab958dbec3a9f864f2cd642574'
AND (
token = 'BXbWHi7ayUgFxHSERaaVGmhTUulho0H9ETQYT4Pk8qk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)