UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1+1NMM1xwZGGyaMZWc8jofbVgew+Xz14ZZJgEfWWKMk=' 
WHERE 
  key_id = 'bad42b3459a2c5221d1032030fadf5f9305965c752daded6f3aa03ba3895a6ee' 
  AND (
    token = '1+1NMM1xwZGGyaMZWc8jofbVgew+Xz14ZZJgEfWWKMk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045