UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gfm9KywwZtaDd1DaJRpukGvkpt9JKrBsE7X8joxkWI8='
WHERE
key_id = '434d55dbc616e58d42fb50c2acf0643932145da2a5f8ef4c9d160be5bc4e7ecd'
AND (
token = 'gfm9KywwZtaDd1DaJRpukGvkpt9JKrBsE7X8joxkWI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)