UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfoOM8Z7ouQHC261qDqftXtZGSJdB8+ZkPqpKLOKu4Q=' 
WHERE 
  key_id = 'c88c054dd24cb43ca4ec23849cf8513876b9a5c6bec5ac031bf3ee694e995f92' 
  AND (
    token = 'BfoOM8Z7ouQHC261qDqftXtZGSJdB8+ZkPqpKLOKu4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029