UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XlxXBbHa3vPoqdIagj++ny3UtbfYJuGXfWdzQEYATeE='
WHERE
key_id = 'd431244e574cc5c5e3ba17ea4c44987786d7f0af878a4983dd5adb71a28e53c7'
AND (
token = 'XlxXBbHa3vPoqdIagj++ny3UtbfYJuGXfWdzQEYATeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)