UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hjYtDJtphadFqhAShMzPmta0CPZyeoY6nlXrBE02Ni8='
WHERE
key_id = '45be9ed1c2ddc115ec720a0a9ed44b87ec542789ea7e69fdc8dd7ea9924d3993'
AND (
token = 'hjYtDJtphadFqhAShMzPmta0CPZyeoY6nlXrBE02Ni8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)