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

Query time 0.00037