UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nbW4gpRPcc1nw9MEwMAOKzodI/bdHqodes5cqNxn6zQ=' 
WHERE 
  key_id = '5190f91f533261e07fedab959077c7f172dc8dd349d2b49d278c50917f4f4001' 
  AND (
    token = 'nbW4gpRPcc1nw9MEwMAOKzodI/bdHqodes5cqNxn6zQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035