UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MWAj6xv4zJDVDSzWYJmk1ESwQhsEYWSE5TIbvHnHg4E=' 
WHERE 
  key_id = '293103e35290fd983167259990b712802aac16b139cc0b88b70c2eccb044c912' 
  AND (
    token = 'MWAj6xv4zJDVDSzWYJmk1ESwQhsEYWSE5TIbvHnHg4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034