UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pd7wZdf0AghqRM9RBNwaGl/YvHMRL2W0C9rYVTmOUuk=' 
WHERE 
  key_id = '5f7c09e704c94e06a38f06bdd9124be587af80f4e34fc44fce082696128e53b6' 
  AND (
    token = 'Pd7wZdf0AghqRM9RBNwaGl/YvHMRL2W0C9rYVTmOUuk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052