UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bmIw7ZlliIrUOdI0KjwvzNFzHuJoQI+yXe++TIR+yo4='
WHERE
key_id = '703247d1b12833bae498a5949be94692f40dcb15d55a283e9b1d75717999f495'
AND (
token = 'bmIw7ZlliIrUOdI0KjwvzNFzHuJoQI+yXe++TIR+yo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)