UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r9HdOuTjo3MRp5IHITUUMjXm9qyfDr2x+w5IditA6wE=' 
WHERE 
  key_id = 'f7fc381ac8b3d27f79c34dc0181e5eca68969288fa4bf8c81244a2fc8ebc4379' 
  AND (
    token = 'r9HdOuTjo3MRp5IHITUUMjXm9qyfDr2x+w5IditA6wE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044