UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9cs2+kRKVRFzpM6g2li4i6yantrakHvu/S0Zhp4XxBE=' 
WHERE 
  key_id = '8d24e1bb4958fc3d72340805a9366e72349f548d4f1c6ee005fb30657a765422' 
  AND (
    token = '9cs2+kRKVRFzpM6g2li4i6yantrakHvu/S0Zhp4XxBE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077