UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lhWvKA1rFVVfmcvJLIG1WaG71io8oDzSqZ0olGdoOT0='
WHERE
key_id = '0a6e86b2b6805a071a11b061de625ad82a2bc9044b433533726167c9aa2d8f98'
AND (
token = 'lhWvKA1rFVVfmcvJLIG1WaG71io8oDzSqZ0olGdoOT0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)