UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GL+0WGuNPzydJ64w1rB+FulfBv9ToTeQYShn+ntgFpM='
WHERE
key_id = 'd0abcc7b048b3b4ae46ae4e977a1d528472a1333e04bcc3bc5832be27582d5dd'
AND (
token = 'GL+0WGuNPzydJ64w1rB+FulfBv9ToTeQYShn+ntgFpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)