UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hRg3Gs3f59HUMk3Bckm6LW2T9R8ZVCkvvMBpyr7gcuA=' 
WHERE 
  key_id = 'b00a25f40a5b6f03596a42775427c1970b4c80d9b17b1977c837a07e4bd456a0' 
  AND (
    token = 'hRg3Gs3f59HUMk3Bckm6LW2T9R8ZVCkvvMBpyr7gcuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061