UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oWqycmWPhOVB2PriB1iFqcNrk8NZ7lVumQpU5CbOP4A=' 
WHERE 
  key_id = '99e3b7a8ba49d03086919a2eb5fd8d57fb5a022f7b6526f50c3cd0e86756b391' 
  AND (
    token = 'oWqycmWPhOVB2PriB1iFqcNrk8NZ7lVumQpU5CbOP4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031