UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SQWisv5NyeliUJOVrad+l+/k7NwogPmuS/aLnL6EvY0='
WHERE
key_id = 'e71799161f239e09cff50690aab1ae99b8e19f3eae732408486d04df40c6eb10'
AND (
token = 'SQWisv5NyeliUJOVrad+l+/k7NwogPmuS/aLnL6EvY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)