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

Query time 0.00033