UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FmDzS7wvvWHFxrqbiKY2d+1l7w16arUIF3VE8TWFS+8='
WHERE
key_id = 'be46180537d8661a60a7abf45ff681372d5f228a941750ac160635712880a317'
AND (
token = 'FmDzS7wvvWHFxrqbiKY2d+1l7w16arUIF3VE8TWFS+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)