UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IvU1cAwy8yaExoqNp3lczk1bDVlBw0tLeQ/Qal1eE9s='
WHERE
key_id = 'f7a690d88504a311ca1840a99d38fec10f2a438eb57f6648e189781a274eda27'
AND (
token = 'IvU1cAwy8yaExoqNp3lczk1bDVlBw0tLeQ/Qal1eE9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)