UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XfCon0nn8Daf74IFCCwySRbCZctqAXMVtDFk0U3L+xc=' 
WHERE 
  key_id = '8b19c6583c8282b00a77b3d5fde87373e77384bfb0cc7ae8ed93c2177331a6f0' 
  AND (
    token = 'XfCon0nn8Daf74IFCCwySRbCZctqAXMVtDFk0U3L+xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024