UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4XGO68v7568dZrFmJ4IB1588bTGZzMP3Pn+Mnan1Q4=' 
WHERE 
  key_id = '7be2cab93df0022a52ba5f307a47fb800e7841e53fdb00476cbfac70318777ac' 
  AND (
    token = 'I4XGO68v7568dZrFmJ4IB1588bTGZzMP3Pn+Mnan1Q4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030