UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/atug8T7d00jlg7/DVWcegvXBqsNYcGDQHh+8iNdVA=' 
WHERE 
  key_id = '643fdbd4aa51833e43e2b9da233822e5738290317c0e1de75d527f73091b3d9a' 
  AND (
    token = 'm/atug8T7d00jlg7/DVWcegvXBqsNYcGDQHh+8iNdVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037