UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VzRpJsKNut+l8uFxuxQwwL76+G1gmxTHEHNEaCxpvtA=' 
WHERE 
  key_id = '59eedd7671e3ff6513c99ebab2080c1dd010eeca74b4cc2fde690ea2ace91668' 
  AND (
    token = 'VzRpJsKNut+l8uFxuxQwwL76+G1gmxTHEHNEaCxpvtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034