UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mw3KvbqyicX1d6DusIct5c3tcXzstUS2XiCNE4feOIA='
WHERE
key_id = '785788976bb90407afff66f11ebf4cd233153b59eec8aa10946f4fcb629a6dbc'
AND (
token = 'Mw3KvbqyicX1d6DusIct5c3tcXzstUS2XiCNE4feOIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)