UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XxookPLHvhgJlPhYZIFJs451ND9IK3aiFf4OJQhoVYg=' 
WHERE 
  key_id = 'a3912b9c49d66518ea4db8be75cc4540c2a1e3a15427a3717f21c7cfa1c9e5a0' 
  AND (
    token = 'XxookPLHvhgJlPhYZIFJs451ND9IK3aiFf4OJQhoVYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045