UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+HUiG7itK0j8BSqn6PMplf24oMT82w8p1cAxWrBbZQ=' 
WHERE 
  key_id = '412f145660bdb8faab7953263f1bcf0101c9a9210d6f97cbee5ea2f69f7ad4e7' 
  AND (
    token = 'Y+HUiG7itK0j8BSqn6PMplf24oMT82w8p1cAxWrBbZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032