UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miCY+aw5Jy1eh6Wk3TWLTvWz7Qh/GK8UI/9mVNFlpnQ=' 
WHERE 
  key_id = '3514bb3a47c04e16a6becb420e5a173888d6dc3ce6247a43221e4bf3e763f5b2' 
  AND (
    token = 'miCY+aw5Jy1eh6Wk3TWLTvWz7Qh/GK8UI/9mVNFlpnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029