UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QhT+M1y39sNTQMKET+tZnUdV9x7kttEcUCIhCEBbSQo='
WHERE
key_id = 'bd093bd58586133146c76893b384f0a49ff79e088c6d6cf7eeafeeb47ea699d0'
AND (
token = 'QhT+M1y39sNTQMKET+tZnUdV9x7kttEcUCIhCEBbSQo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)