UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ma2CqAv6l9fTC8ipC8sgEKIWM4biaaThIY7DpCcYYJU='
WHERE
key_id = '017e9f7c20d646bf57aa920eb540170a811549470adb764da8ea8ccf6adfebe5'
AND (
token = 'Ma2CqAv6l9fTC8ipC8sgEKIWM4biaaThIY7DpCcYYJU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)