UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'As+7Yoto0mZM2qO+p4U40C/ElJIOyTGRh4feK+QYX3c='
WHERE
key_id = 'f67da3798f5f43d099c8c599b7d8ee77fbe9588edec6018dd3322929bcda6816'
AND (
token = 'As+7Yoto0mZM2qO+p4U40C/ElJIOyTGRh4feK+QYX3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)