UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'glqDLrAS66S7i+Cevm35s7LTn8kvBomVLAyhftGDvXA=' 
WHERE 
  key_id = '183e988cc12189c2b385078d667882b7a0fd91b05afc427c5b13c94f4b0b4d52' 
  AND (
    token = 'glqDLrAS66S7i+Cevm35s7LTn8kvBomVLAyhftGDvXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040