UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A23baahMrGrVlJIm/QZbePbqw4I0yL3x7iLuYJYK0BE='
WHERE
key_id = 'c47abfd6a9480dd379d7b021958a824ab1e35d88c73b14a22ec56f4790074cbc'
AND (
token = 'A23baahMrGrVlJIm/QZbePbqw4I0yL3x7iLuYJYK0BE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)